﻿@using Easy.Web.CMS.WidgetTemplate
@model WidgetTemplateViewModel
@{
    Style.Reqiured("Layout").AtFoot();
}
<div class="panel panel-default">
    <div class="panel-heading">
        <div>选择组件</div>
    </div>
    <div class="panel-body">
        @using (Html.BeginForm("RedirectToWidget", "WidgetTemplate", new { module = "Common", Model.PageID, Model.LayoutID, Model.ZoneID, Model.ReturnUrl }))
        {
            foreach (var item in this.Model.WidgetTemplates.GroupBy(m => m.GroupName).OrderBy(m=>m.Key))
            {
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <div>@item.Key</div>
                    </div>
                    <div class="panel-body">
                        @foreach (WidgetTemplateEntity template in item.OrderBy(m=>m.Order))
                        {
                            <div class="col-lg-2 col-md-3 col-sm-4">
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="WidgetTemplateID" value="@template.ID"/>
                                        @template.Title
                                    </label>
                                </div>
                            </div>
                        }
                    </div>
                </div>


            }
            <div class="toolBar">
                <input id="design" type="submit" class="btn btn-primary" value="下一步" />
                <input type="button" class="btn btn-default cancel" value="取消" />
            </div>
        }
    </div>
</div>
@using (Script.AtFoot())
{
    <script type="text/javascript">
        $("input[type=radio]:first").attr("checked", "checked");
    </script>
}